package com.example.vip1.jianzaozhe;

/**
 * *******************************************************
 * Author: chinadragon
 * Time: 8/15/21 4:11 PM
 * Name:
 * Overview:
 * Usage:
 * *******************************************************
 */
public class House3 {
    private double height;
    private double width;
    private String color;

    public House3(Builder builder) {
        this.color = builder.color;
        this.height = builder.height;
        this.width = builder.width;
    }

    public static final class Builder {
        double height;
        double width;
        String color;

        public Builder() {
            this.height = 100;
            this.width = 100;
            this.color = "red";
        }

        public Builder addHeight(double height) {
            this.height = height;
            return this;
        }

        public Builder addWidth(double width) {
            this.width = width;
            return this;
        }

        public Builder addColor(String color) {
            this.color = color;
            return this;
        }


        public House3 build(){
            return new House3(this);
        }
    }

    @Override
    public String toString() {
        return "真实房子 House3{" +
                "height=" + height +
                ", width=" + width +
                ", color='" + color + '\'' +
                '}';
    }
}
